# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Arch Haskell Team <arch-haskell@haskell.org>

pkgname=hledger-ui
pkgver=1.31
pkgrel=30
pkgdesc="Curses-style terminal interface for the hledger accounting system"
url="http://hledger.org"
license=("GPL")
arch=('loong64' 'x86_64')
depends=('ghc-libs' 'hledger' 'haskell-hledger-lib' 'haskell-ansi-terminal' 'haskell-async'
         'haskell-cmdargs' 'haskell-data-default' 'haskell-doclayout' 'haskell-extra'
         'haskell-fsnotify' 'haskell-microlens' 'haskell-microlens-platform' 'haskell-megaparsec'
         'haskell-safe' 'haskell-split' 'haskell-text-zipper' 'haskell-vector' 'haskell-brick'
         'haskell-vty')
makedepends=('ghc')
source=("https://hackage.haskell.org/packages/archive/${pkgname}/${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('3b306314b491a0b7a8ecbb727de8a7cd116c451bd47fb83ecec5dbcbd8e2a69ee71514fb8a99d053095e9d9837bf1872b928a6261c7203cc2626c851ce6ee82d')

build() {
    cd $pkgname-$pkgver
    runhaskell Setup configure -O --enable-executable-dynamic --disable-library-vanilla \
        --prefix=/usr --docdir="/usr/share/doc/$pkgname" --datasubdir=$pkgname --enable-tests \
            -fthreaded
    runhaskell Setup build $MAKEFLAGS
}

check() {
    cd $pkgname-$pkgver
    runhaskell Setup test --show-details=direct
}

package() {
    cd $pkgname-$pkgver
    runhaskell Setup copy --destdir="$pkgdir"
    rm -f "$pkgdir"/usr/share/doc/$pkgname/LICENSE

    install -Dm644 hledger-ui.1 -t "$pkgdir"/usr/share/man/man1/
}
